-- metatable example
t = {}
mt = 
{
    __index = function(t, key) 
        -- dynamically calculate the value of key
        print("accessed key ", key)
        return 37 
    end,

    __newindex = function(t, key, value) 
        print("setting value ", value, "of the key", key)
    end
}

setmetatable(t, mt)

a = t.a
t.x = 5
print(a)
